package com.imageview.app;

import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
import com.nostra13.universalimageloader.core.assist.QueueProcessingType;

import android.app.Application;
import android.content.Context;

public class MyApplication extends Application {

	private ImageLoader imageloader;
	
	@Override
	public void onCreate() {
		super.onCreate();
		init(this);
	}

	private void init(Context context) {
		ImageLoaderConfiguration configuration=new ImageLoaderConfiguration.
				  Builder(context).threadPriority(3)
				  .denyCacheImageMultipleSizesInMemory().//缓存显示不同大小的同一张图片
				  diskCacheFileNameGenerator(new Md5FileNameGenerator()). //文件名字的加密策略
				  tasksProcessingOrder(QueueProcessingType.LIFO).build(); 
		
		imageloader = ImageLoader.getInstance();
		imageloader.init(configuration);
	}
}
